// 局部变量
function test() {
    let a = 1;
    a += 1;

    function inner() {
        let a = 2;
        console.log(a);
    }

    inner();
}

test();

// 全局变量, var声明的变量其实是绑定在window对象上
let a = "a";
var b = "b";
alert(a);
alert(b);
alert(window.a);
alert(window.b);

// 降低命名冲突的问题
let MyApp = {};
MyApp.name = "name";
MyApp.age = "age";
MyApp.add = function (x, y) {
    return x + y;
};

